package com.lhd.thread;

import java.io.IOException;
import java.util.List;

import com.lhd.bean.Colinfo;
import com.lhd.tool.Tool2;

/**
 * 自定义线程
 */
public class MyThread implements Runnable {
    private final int threadNum; // 线程总数
    private final int threadNo; // 第几个线程
    private final int totalRows; // 要生成的总行数
    private final String fileName; // 文件名
    private final List<Colinfo> collist; // 某表的列信息

    public MyThread(String fileName, List<Colinfo> collist, int threadNum, int threadNo, int totalRows) {
        this.threadNum = threadNum;
        this.fileName = fileName;
        this.collist = collist;
        this.threadNo = threadNo;
        this.totalRows = totalRows;
    }

    @Override
    public void run() {
        try {
            new Tool2(collist, fileName).SaveAsBufferWriter(fileName, threadNum,threadNo,totalRows);
        } catch (IOException e) {
            e.printStackTrace();
        }
        //new MyPrint().print(fileName);

    }
}
